var mongoose = require("mongoose");

//文章表(article)

var articleSchema = new mongoose.Schema({
  articlename: {
    type: String,
    required: true
  }, //文章标题
  articleimg: {
    type: String
  }, //文章主图
  content: {
    type: String,
    required: true
  }, //富文本内容
  userid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "user_login",
    required: true
  }, //用户id
  release_time: {
    type: Date,
    default: new Date()
  }, //发布时间
  aeticletype: {
    type: String,
    required: true
  }, //文章类型
  textReplace: {
    type: String
  }, //文章缩略
  reading: {
    type: Number,
    default: 0
  }, //阅读量
  reply: {
    type: Number,
    default: 0
  }, //回复量
  praise: {
    type: Array,
    default: []
  }, //赞量
  praiseSize: {
    type: Number,
    default: 0
  }, //赞量
  audit: {
    type: Boolean,
    default: false
  }, //审核
  shareArticle: [{
    title: String,
    url: String
  }] //分享文章
});

module.exports = mongoose.model("article", articleSchema);